from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token
from apps.meiduo_admin.views import statistical, users, specs, images, skus, options, channels, brands,orders,perms,groups,admins
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('goods/specs', specs.SpecsView, basename='specs')
router.register('skus/images', images.ImagesView, basename='images')
router.register('skus', skus.SKUSView, basename='skus')
# 规格选项 specs/options
router.register('specs/options', options.OptionsView, basename='options')
# 频道管理 goods/channels
router.register('goods/channels', channels.ChannelsView, basename='channels')
# 品牌管理 goods/brands
router.register('goods/brands', brands.BrandsView, basename='brands')

# 订单表管理  orders
router.register('orders', orders.OrdersView, basename='orders')

# 权限表管理 permission/perms
router.register('permission/perms', perms.PermsView, basename='perms')

# 分组表管理 permission/groups
router.register('permission/groups', groups.GroupsView, basename='groups')

# 管理员管理 permission/admins
router.register('permission/admins', admins.AdminsView, basename='admins')






urlpatterns = [
    # 使用JWT提供的方法完整登录的状态保持
    path('authorizations/', obtain_jwt_token),

    # 数据统计
    # 用户总数统计 statistical/total_count/
    path('statistical/total_count/', statistical.UserTotalCountView.as_view()),
    # 日增用户
    path('statistical/day_increment/', statistical.UserDayIncrementView.as_view()),
    # 日活用户
    path('statistical/day_active/', statistical.UserDayActiveView.as_view()),
    # 日下单用户
    path('statistical/day_orders/', statistical.UserDayOrdersView.as_view()),
    # 月增用户  statistical/month_increment/
    path('statistical/month_increment/', statistical.UserMonthIncrementView.as_view()),
    # 商品分类访问量统计 statistical/goods_day_views/
    path('statistical/goods_day_views/', statistical.GoodsDayView.as_view()),

    # 用户管理
    path('users/', users.UsersView.as_view()),
    # 获取简单spu数据 视图集路由匹配需要指定键值对
    path('goods/simple/', specs.SpecsView.as_view({'get': 'simple'})),
    # 获取简单sku数据 视图集路由匹配需要指定键值对
    path('skus/simple/', images.ImagesView.as_view({'get': 'simple'})),
    # 获取规格选项数据
    path('goods/<int:pk>/specs/', skus.SKUSView.as_view({'get': 'specs'})),
    # 获取权限列表数据
    path('permission/content_types/', perms.PermsView.as_view({'get': 'content_types'})),
    # 获取简单权限表数据
    path('permission/simple/', groups.GroupsView.as_view({'get': 'simple'})),
    # 获取简单分组表
    path('permission/groups/simple/', admins.AdminsView.as_view({'get': 'simple'})),


]
urlpatterns += router.urls
